package com.mall.platform;

import com.mall.platform.annotation.EnablePlatformDalConfiguration;
import com.mall.platform.mapper.RunoobTblMapper;
import com.mall.platform.model.RunoobTbl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@EnablePlatformDalConfiguration
@Controller
@SpringBootApplication
public class PlatformApplication {
    public static void main(String[] args) {
        SpringApplication.run(PlatformApplication.class, args);
    }

    @RequestMapping("/test/hello.html")
    public String sayHi(Model model){
        model.addAttribute("name","xiangzhq");
        return "helloWorld";
    }

    @RequestMapping("/test/mapper")
    @ResponseBody
    public String testMapper(){
        RunoobTbl runoobTbl = runoobTblMapper.selectByPrimaryKey(1);
        System.out.println(runoobTbl);
        
        return "ok";
    }

    @Autowired
    private RunoobTblMapper runoobTblMapper;
}
